package com.isoft.src.main.java.model;

public class User {
    private String username;
    private String password;
    private Cart cart;

    public User(String username, String password) {
        this.username = username;
        this.password = password;
        this.cart = new Cart();
    }

    public String getUsername() { return username; }
    public void setUsername(String username) { this.username = username; }

    public String getPassword() { return password; }
    public void setPassword(String password) { this.password = password; }

    public Cart getCart() { return cart; }

    public void addToCart(Product product, int quantity) {
        cart.addProduct(product, quantity);
    }

    public void removeFromCart(Product product) {
        cart.removeProduct(product);
    }

    public void checkout(Order order) {
        // Simulate saving order to a database or file
        System.out.println("Order placed successfully!");
        cart.clear();
    }
}